﻿#include "FrameMain/DABaseFrame.h"
#include "PlayConfig.h"
#include "QtPotPlayer.h"
#include "FrameMain/FrameMain.h"
#include "Utils/GloabTool/FuncTools.h"
#include "Utils/QPTypes.h"

#include <QApplication>
#include <QFile>
#include <QStyleFactory>

#define HighDpi 1

#define DEBUG_PCONFIG 0

int main(int argc, char *argv[])
{
    QApplication::setStyle(QStyleFactory::create("Fusion"));
    FunTools::GetInst()->setStyle(":/QPStyle/style.css");
#if HighDpi
    qputenv("QT_SCALE_FACTOR", "1.0");
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
    QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Unset);
#else
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
    QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Unset);
#endif
#endif
    QApplication a(argc, argv);
    
    
#if RADIUS
    FrameMain *fm =new FrameMain();
    DABaseFrame *W =new DABaseFrame();
    W->addWdiget(fm);
    fm->setFrameIco(":/QPStyle/image/logo.png");
    fm->setFrameTitle("QtPotPlayer");
    fm->setMainWidget(new QtPotPlayer);
#else
    
    #if DEBUG_PCONFIG
        PlayConfig *W = new PlayConfig;
    #else
        FrameMain *W =new FrameMain();
        W->setFrameIco(":/QPStyle/image/logo.png");
        W->setFrameTitle("QtPotPlayer");
        W->setMainWidget(new QtPotPlayer);
        FunTools::GetInst()->SetPosition(W,QP::POSITION::HVCenter); 
    #endif
    
#endif
    W->show();
    return a.exec();
}
